<template>
    <div class="buju">
        <div>
            <h1>登录</h1>
        </div>
        <div>
            账号名: <input type="text" placeholder="请输入你的账号" v-model="account">


        </div>
        <div>
            密码: <input type="password" placeholder="请输入你的密码" v-model="password">
        </div>
        <button @click="login" style="width:100px,height: 300px;">登录</button>

    </div>
    
</template>
<script>
export default {
    name: "Login",
    data() {
        return {
            account: "JayChou",
            password: "666666"
        }
    },
    methods: {
        login() {
            if (this.account === 'JayChou' && this.password === '666666') {
                alert('登录成功')
                const usrInfo = {
                    name: 'JayChou',
                    phone: '13122223333',
                    gender: '男'
                }
                this.$store.commit('updateUserInfo', usrInfo)
                this.$router.push({ path: '/user' })
            } else {
                alert('账号密码错误，请重新输入')
            }
        }
    },
}
</script>

<style scoped>
.buju{
    height: 250px;
    width: 250px;
    margin-left: 300px;
  
}

</style>